﻿using Mapster;
using SqlSugar;
using System;
using System.Collections.Generic;

namespace Raffles.OA.Data
{
    /// <summary>
    /// 日 期：2024/7/23 11:23:33
    /// 描 述：项目管理实体类
    /// </summary>
    [SugarTable("Project")]
    public partial class ProjectEntity : BaseEntity
    {
        /// <summary>
        /// 表单类型
        /// </summary>
        public string FormType { get; set; }
        /// <summary>
        /// 项目Id,用于分段
        /// </summary>
        public int? ParentId { get; set; }
        /// <summary>
        /// 项目编号
        /// </summary>
        public string Code { get; set; }
        /// <summary>
        /// 项目名称
        /// </summary>
        public string Name { get; set; }
        /// <summary>
        /// 合同编号
        /// </summary>
        public string ContractCode { get; set; }
        /// <summary>
        /// 行程分段
        /// </summary>
        [AdaptIgnore(MemberSide.Source)]
        public string CountrySegment { get; set; }
        /// <summary>
        /// 行程分段
        /// </summary> 
        public string CountrySegmentCN { get; set; }
        /// <summary>
        /// 报价类目
        /// </summary>
        [AdaptIgnore(MemberSide.Source)]
        public string QuotationItemCode { get; set; } 
        /// <summary>
        /// 渠道Id
        /// </summary>
        public int? CustomerId { get; set; }
        /// <summary>
        /// 渠道名称
        /// </summary>
        public string CustomerName { get; set; }
        /// <summary>
        /// 渠道经理
        /// </summary>
        public int? CustomerUserId { get; set; }
        /// <summary>
        /// 渠道经理
        /// </summary>
        public string CustomerUserName { get; set; }
        /// <summary>
        /// 联系方式
        /// </summary>
        public string CustomerUserPhone { get; set; }
        /// <summary>
        /// 出发日期
        /// </summary>
        public DateTime? DepartureDate { get; set; }
        /// <summary>
        /// 回程日期
        /// </summary>
        public DateTime? ReturnDate { get; set; }
        /// <summary>
        /// 出行天数
        /// </summary>
        public int? DayTotal { get; set; }
        /// <summary>
        /// 报价日期
        /// </summary>
        public DateTime? QuotationDate { get; set; }
        /// <summary>
        /// 成人数量
        /// </summary>
        public int AdultTotal { get; set; }
        /// <summary>
        /// 儿童数量
        /// </summary>
        public int ChildTotal { get; set; }
        /// <summary>
        /// 领队人数
        /// </summary>
        public int TeamLeader { get; set; }
        /// <summary>
        /// 销售人员
        /// </summary>
        public int? SaleManagerId { get; set; }
        /// <summary>
        /// 销售人员
        /// </summary>
        public string SaleManagerName { get; set; }
        /// <summary>
        /// 参与人员
        /// </summary>
        [AdaptIgnore(MemberSide.Source)]
        public string InvolveId { get; set; }
        /// <summary>
        /// 参与人员
        /// </summary> 
        public string InvolveCN { get; set; }
        /// <summary>
        /// 结算汇率
        /// </summary>
        public decimal? SettlementRate { get; set; }
        /// <summary>
        /// 付款汇率
        /// </summary>
        public decimal? PaymentRate { get; set; }
        /// <summary>
        /// 是否显示税后
        /// </summary>
        public bool? IsTaxShow { get; set; }
        /// <summary>
        /// 结算税率
        /// </summary>
        public decimal? TaxRate { get; set; }
        /// <summary>
        /// 结算货币
        /// </summary>
        public string SettlementCurrency { get; set; } 
        /// <summary>
        /// 结算货币
        /// </summary>
        public string SettlementCurrencyCN { get; set; }
        /// <summary>
        /// 销售税前金额(结算货币)
        /// </summary>
        public decimal? SaleSGDAmountBeforeTax { get; set; }
        /// <summary>
        /// 销售税前金额(人民币)
        /// </summary>
        public decimal? SaleRMBAmountBeforeTax { get; set; }
        /// <summary>
        /// 税前人均(人民币)
        /// </summary>
        public decimal? AverageSaleRMBAmountBeforeTax { get; set; }
        /// <summary>
        /// 销售税后金额(结算货币)
        /// </summary>
        public decimal? SaleSGDAmountAfterTax { get; set; }
        /// <summary>
        /// 销售税后金额(人民币)
        /// </summary>
        public decimal? SaleRMBAmountAfterTax { get; set; }
        /// <summary>
        /// 税后人均(人民币)
        /// </summary>
        public decimal? AverageSaleRMBAmountAfterTax { get; set; }
        /// <summary>
        /// 成本税前支出(结算货币)
        /// </summary> 
        public decimal? CostSGDAmountBeforeTax { get; set; }
        /// <summary>
        /// 成本税前支出(人民币)
        /// </summary> 
        public decimal? CostRMBAmountBeforeTax { get; set; }
        /// <summary>
        /// 成本税后支出(结算货币)
        /// </summary> 
        public decimal? CostSGDAmountAfterTax { get; set; }
        /// <summary>
        /// 成本税后支出(人民币)
        /// </summary> 
        public decimal? CostRMBAmountAfterTax { get; set; }
        /// <summary>
        /// 项目状态
        /// </summary>
        public int? Status { get; set; }
        /// <summary>
        /// 成本支付状态
        /// </summary>
        public int? PayStatus { get; set; }
        /// <summary>
        /// 成本支付申请时间
        /// </summary>
        public DateTime? PayApplyOn { get; set; }

        /// <summary>
        /// 成本审核人员
        /// </summary>
        public string PayAuditId { get; set; }
        /// <summary>
        /// 成本支付申请审核时间
        /// </summary>
        public DateTime? PayAuditOn { get; set; }
        /// <summary>
        /// 颜色
        /// </summary>
        public string Color { get; set; }
        /// <summary>
        /// 操作率
        /// </summary>
        public decimal OperateRate { get; set; }
        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime? CreatedOn { get; set; } = DateTime.Now;
        /// <summary>
        /// 创建人
        /// </summary>
        public int? CreatedBy { get; set; }
        /// <summary>
        /// 编辑时间
        /// </summary>
        public DateTime? UpdatedOn { get; set; } = DateTime.Now;
        /// <summary>
        /// 编辑人
        /// </summary>
        public int? UpdatedBy { get; set; }
    }

    public partial class ProjectEntity
    {
        /// <summary>
        /// 项目定金
        /// </summary>
        [Navigate(NavigateType.OneToMany, nameof(ProjectPaymentEntity.ProjectId))]
        public List<ProjectPaymentEntity> ProjectPayments { get; set; }
        /// <summary>
        /// 项目回款
        /// </summary>
        [Navigate(NavigateType.OneToMany, nameof(ProjectReturnPaymentEntity.ProjectId))]
        public List<ProjectReturnPaymentEntity> ProjectReturnPayments { get; set; }
        /// <summary>
        /// 项目运营成本
        /// </summary>
        [Navigate(NavigateType.OneToMany, nameof(ProjectOperateCostEntity.ProjectId))]
        public List<ProjectOperateCostEntity> ProjectOperateCosts { get; set; }
    }

    public partial class ProjectEntity
    { 
        /// <summary>
        /// 财务结算单明细
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public List<ProjectEntity> ProjectSegments { get; set; }
        /// <summary>
        /// 项目回款总额(定金+历史回款)
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public decimal? TotalAdvancePaymentAmount { get; set; }
        /// <summary>
        /// 项目回款总额(定金+历史回款)
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public decimal? TotalReturnPaymentAmount { get; set; }
        /// <summary>
        /// 项目运营成本
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public decimal? TotalOperateCostAmount { get; set; }
        /// <summary>
        /// 销售提成
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public decimal? SalerCommissionAmount { get; set; }
    }
}
